/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GameState;

import java.awt.Graphics2D;
import java.util.Timer;
import GameAI.*;
import GameCore.*;
import GameObject.Background;
import ResourceManager.ManagerDefine;
import java.util.ArrayList;

/**
 *
 * @author NGUYEN VAN TAM
 */
public class GamePlay extends GameState{
    public Player West;
    public Player North;
    public Player East;
    public Player You;
    public CenterPlayer Center;
    public Client client;
    Background background;
    
    ArrayList<Player> listPlayer;
    
    
    @Override
    public void Init()
    {
        /*West = new Player();
        North = new Player();
        East = new Player();
        You = new Player();
        Center = new CenterPlayer();
        client = new Client();*/
        
        // khởi tạo background nền cho game play
        ManagerDefine.Init();
        background = (Background)ManagerDefine.backgroundManager.CreateObject(0);
    }
    
    public void Start()
    {
        //chưa khỏi tạo client
        client.ConnectToServer();
    }
    
    @Override
    public void Update(Timer gameTime)
    {
        /*TranslateAndDispatchMessage();
        
        Center.Update(gameTime);
        You.Update(gameTime);
        West.Update(gameTime);
        North.Update(gameTime);
        East.Update(gameTime);
        
        TranslateAndSendMessage();*/
    }
    
    @Override
    public void Draw(Timer gameTime,Graphics2D graphic)
    {
        background.Draw(gameTime, graphic);
        /*
        You.Draw(gameTime,graphic);
        West.Draw(gameTime,graphic);
        North.Draw(gameTime,graphic);
        East.Draw(gameTime,graphic);
        Center.Draw(gameTime,graphic);*/
    }
    
    //nhận thông tin từ server phân tích và chuyễn cho 4 người chơi
    public void TranslateAndDispatchMessage()
    {
        String message = client.trans.RecieveMessage();
        //
    }
    
    // chuyễn thông tin thay đổi lên server send cho các người chơi còn lại
    public void TranslateAndSendMessage()
    {
        //
        client.trans.SendMessage(null);
    }
    
    //thiết lập màn chơi mới tiếp theo sau khi game phân biệt thắng thua
    public void Reset()
    {
        
    }
}
